﻿using System;
using SharpSqlAnalyzer.pp.processor;
using SharpSqlAnalyzer.pp.stmtformatter.type;
using SharpSqlAnalyzer.pp.stmtformatter.type.comm;

namespace SharpSqlAnalyzer.pp.stmtformatter.builder.comm
{
	// Token: 0x02000229 RID: 553
	public class SelectStmtFormatterBuilder : AbstractStmtFormatterBuilder
	{
		// Token: 0x0600128B RID: 4747 RVA: 0x0031954E File Offset: 0x0031774E
		protected internal override AbstractStmtFormatter newInstanceFormatter()
		{
			return new SelectStmtFormatter();
		}

		// Token: 0x0600128C RID: 4748 RVA: 0x00319558 File Offset: 0x00317758
		protected internal override void initSpecialProcessorForFormatter(AbstractStmtFormatter formatterArg)
		{
			SelectStmtFormatter selectStmtFormatter = formatterArg as SelectStmtFormatter;
			selectStmtFormatter.addSpecialProcessor(ProcessorFactory.createCapitalisationProcessor(this.Option));
			selectStmtFormatter.addSpecialProcessor(ProcessorFactory.createCombineWhitespaceAndClearReturnProcessor(this.Option));
			selectStmtFormatter.addSpecialProcessor(ProcessorFactory.createSelectKeyWordAlignProcessor(this.Option));
			selectStmtFormatter.addSpecialProcessor(ProcessorFactory.createCTEProcessor(this.Option, new bool?(this.Option.cteNewlineBeforeAs)));
			selectStmtFormatter.addSpecialProcessor(ProcessorFactory.createDistinctKeyWordProcessor(this.Option, this.Option.treatDistinctAsVirtualColumn));
			selectStmtFormatter.addItemListProcessor(ProcessorFactory.appendNewLineAfterReverseKeyWordProcessor(this.Option, this.Option.selectItemInNewLine, "select"));
			selectStmtFormatter.addItemListProcessor(ProcessorFactory.createColumnlistCommaProcessor(this.Option, this.Option.selectColumnlistComma, this.Option.selectColumnlistStyle));
			selectStmtFormatter.addItemListAlignProcessor(ProcessorFactory.createAlignAliasProcessor(this.Option, this.Option.alignAliasInSelectList, this.Option.selectColumnlistStyle));
			selectStmtFormatter.addTableClauseProcessor(ProcessorFactory.appendNewLineAfterAndBeforeReverseKeyWordProcessor(this.Option, this.Option.fromClauseInNewLine, "from", null));
			selectStmtFormatter.addTableClauseProcessor(ProcessorFactory.createColumnlistCommaProcessor(this.Option, this.Option.selectFromclauseComma, this.Option.selectFromclauseStyle));
			selectStmtFormatter.addIntoClauseProcessor(ProcessorFactory.appendNewLineAfterAndBeforeReverseKeyWordProcessor(this.Option, this.Option.fromClauseInNewLine, "into", null));
			selectStmtFormatter.addFromJoinClauseProcessor(ProcessorFactory.createJoinOnProcessor(this.Option, this.Option.selectFromclauseJoinOnInNewline, this.Option.alignJoinWithFromKeyword));
			selectStmtFormatter.addGroupByClauseProcessor(ProcessorFactory.appendNewLineAfterAndBeforeReverseKeyWordProcessor(this.Option, this.Option.selectItemInNewLine, "group", "by"));
			selectStmtFormatter.addGroupByClauseProcessor(ProcessorFactory.createColumnlistCommaProcessor(this.Option, this.Option.selectColumnlistComma, this.Option.selectColumnlistStyle));
			selectStmtFormatter.addHavingClauseProcessor(ProcessorFactory.appendNewLineAfterAndBeforeReverseKeyWordProcessor(this.Option, this.Option.selectItemInNewLine, "having", null));
			selectStmtFormatter.addOrderByClauseProcessor(ProcessorFactory.appendNewLineAfterAndBeforeReverseKeyWordProcessor(this.Option, this.Option.selectItemInNewLine, "order", "by"));
			selectStmtFormatter.addOrderByClauseProcessor(ProcessorFactory.createColumnlistCommaProcessor(this.Option, this.Option.selectColumnlistComma, this.Option.selectColumnlistStyle));
			selectStmtFormatter.addWhereClauseProcessor(ProcessorFactory.createAppendNewLineBeforeReverseKeyWordProcessor(this.Option, true, "where"));
			selectStmtFormatter.addWhereExpProcessors(ProcessorFactory.createExpressionProcessor(this.Option, new bool?(this.Option.andOrUnderWhere)));
			selectStmtFormatter.UnionProcessor = ProcessorFactory.createUnionProcessor(this.Option);
		}
	}
}
